package com.cjt.controller;


import com.cjt.common.dto.StuSubjectDto;
import com.cjt.common.lang.R;
import com.cjt.service.SubjetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Objects;

@RestController
@RequestMapping("/stu")
public class SubjectController {

    @Autowired
    SubjetService subjetService;


    @PostMapping("/getsubect/{id}")
    public R getsub(@PathVariable Integer id) {
        List<StuSubjectDto> list = subjetService.getsub(id);
        return R.success(list);
    }


    @PostMapping("/savesub/{subid}")
    public R savesub(@PathVariable String subid) {
        Long aLong = Long.valueOf(subid);
        subjetService.cakeCla(aLong);
        return R.success(null);
    }

    @PostMapping("/delsub/{subid}")
    public R delsub(@PathVariable Long subid) {
        subjetService.delCla(subid);
        return R.success(null);
    }

}
